[IA64] Remove obsolete bug work around code in xc_ia64_stubs.c.
authorAlex Williamson <alex.williamson@hp.com>
Mon, 7 May 2007 19:24:37 +0000 (13:24 -0600)
committerAlex Williamson <alex.williamson@hp.com>
Mon, 7 May 2007 19:24:37 +0000 (13:24 -0600)
Now xencomm solved the issue.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
tools/libxc/ia64/xc_ia64_stubs.c

index 6d192d6e534c4c9c27f4ba3ca838a2c7c423cca1..f5550c09cd4dee93494af7dd58f592abdd419152 100644 (file)
@@ -23,54 +23,28 @@ xc_ia64_fpsr_default(void)
     return FPSR_DEFAULT;
 }
 
-/*  
-    VMM uses put_user to copy pfn_list to guest buffer, this maybe fail,
-    VMM doesn't handle this now.
-    This method will touch guest buffer to make sure the buffer's mapping
-    is tracked by VMM,
- */
 int
 xc_ia64_get_pfn_list(int xc_handle, uint32_t domid, xen_pfn_t *pfn_buf,
                      unsigned int start_page, unsigned int nr_pages)
 {
-    struct xen_domctl domctl;
-    int num_pfns,ret;
-    unsigned int __start_page, __nr_pages;
-    xen_pfn_t *__pfn_buf;
-
-    __start_page = start_page;
-    __nr_pages = nr_pages;
-    __pfn_buf = pfn_buf;
-  
-    while (__nr_pages) {
-        domctl.cmd = XEN_DOMCTL_getmemlist;
-        domctl.domain = (domid_t)domid;
-        domctl.u.getmemlist.max_pfns = __nr_pages;
-        domctl.u.getmemlist.start_pfn =__start_page;
-        domctl.u.getmemlist.num_pfns = 0;
-        set_xen_guest_handle(domctl.u.getmemlist.buffer, __pfn_buf);
-
-        if (mlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t)) != 0) {
-            PERROR("Could not lock pfn list buffer");
-            return -1;
-        }
+    DECLARE_DOMCTL;
+    int ret;
 
-        ret = do_domctl(xc_handle, &domctl);
-
-        (void)munlock(__pfn_buf, __nr_pages * sizeof(xen_pfn_t));
-
-        num_pfns = domctl.u.getmemlist.num_pfns;
-        __start_page += num_pfns;
-        __nr_pages -= num_pfns;
-        __pfn_buf += num_pfns;
+    domctl.cmd = XEN_DOMCTL_getmemlist;
+    domctl.domain = (domid_t)domid;
+    domctl.u.getmemlist.max_pfns = nr_pages;
+    domctl.u.getmemlist.start_pfn = start_page;
+    domctl.u.getmemlist.num_pfns = 0;
+    set_xen_guest_handle(domctl.u.getmemlist.buffer, pfn_buf);
 
-        if (ret < 0)
-            // dummy write to make sure this tlb mapping is tracked by VMM
-            *__pfn_buf = 0;
-        else
-            return nr_pages;
+    if (lock_pages(pfn_buf, nr_pages * sizeof(xen_pfn_t)) != 0) {
+        PERROR("Could not lock pfn list buffer");
+        return -1;
     }
-    return nr_pages;
+    ret = do_domctl(xc_handle, &domctl);
+    unlock_pages(pfn_buf, nr_pages * sizeof(xen_pfn_t));
+
+    return ret < 0 ? -1 : nr_pages;
 }
 
 int